package com.aida.evil.eda.Recommend;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

import com.aida.evil.aida.R;

/****************************************************
 * com.aida.evil.eda.Recommend.AppRecommend
 * 作者：白雨濃  evil
 * 时间：16-4-15 17:27
 * 邮箱：evilbai@foxmail.com
 * 页面用途：软件推荐
 ****************************************************/
public class AppRecommend extends AppCompatActivity
{
    private Toolbar toolbar;


    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.apprecommend);

        setToolbar();/*设置顶部栏*/
    }

    /**
     * 设置toolbar
     */
    private void setToolbar()
    {
        toolbar = (Toolbar) findViewById(R.id.apprecommend_toolbar);
        toolbar.setTitle("软件推荐");
        setSupportActionBar(toolbar);//作用不明确
        getSupportActionBar().setHomeButtonEnabled(true);//作用不明确
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    /**
     * toolbar返回键监听
     *
     * @param item
     * @return
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        if (item.getItemId() == android.R.id.home)
        {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onBackPressed()
    {
        super.onBackPressed();
        finish();
    }
}
